How do I reverse the source and target choices in a linket

I have a link module created and a one linkset created within it.
The linkset, however, has been created incorrectly, with the source and target module reversed.
In other words, the links between the information in the two modules are correct but they go in the wrong direction.

Is there a way to simply switch the source and target modules in the linkset and have all the links follow suit and reverse direction?

Thanks for your help.

Cp.
CP@Goodrich - Tue Sep 25 17:37:14 EDT 2012

Re: How do I reverse the source and target choices in a linket
BenSharples - Wed Sep 26 09:10:54 EDT 2012

Create the linkset you want in the correct direction.

From the module you want the links to start (i.e. actual source, currently your target) create a dxl script that runs through getting the object handles for each end of the links and then creating the new link, at the same time you will have a handle on the incorrect link and can set that to delete.

something like below
 

Module m = current
Object o, othero
Link lnk
 
for o in m do {
 
    for lnk in o do {
 
          othero = source lnk
          delete lnk
 
          o -> "Link Module Name" -> othero
    }
}

 


note open the other module in edit mode before you start

 

Re: How do I reverse the source and target choices in a linket
CP@Goodrich - Wed Sep 26 14:22:19 EDT 2012

BenSharples - Wed Sep 26 09:10:54 EDT 2012

Create the linkset you want in the correct direction.

From the module you want the links to start (i.e. actual source, currently your target) create a dxl script that runs through getting the object handles for each end of the links and then creating the new link, at the same time you will have a handle on the incorrect link and can set that to delete.

something like below
 

Module m = current
Object o, othero
Link lnk
 
for o in m do {
 
    for lnk in o do {
 
          othero = source lnk
          delete lnk
 
          o -> "Link Module Name" -> othero
    }
}

 


note open the other module in edit mode before you start

 

Thanks for the response. I am still very new at the DXL language and I am having trouble correcting the script you wrote for me.

It says there is an error in line 7.

Thanks for clarifying.

Cp.

Re: How do I reverse the source and target choices in a linket
BenSharples - Thu Sep 27 07:55:10 EDT 2012

CP@Goodrich - Wed Sep 26 14:22:19 EDT 2012
Thanks for the response. I am still very new at the DXL language and I am having trouble correcting the script you wrote for me.

It says there is an error in line 7.

Thanks for clarifying.

Cp.

Sorry, I forgot the lnk module bit
 

for lnk in o <- "*" do {

 


note make sure you have the other module(s) open in edit mode first. It is possible to do without but the DXL gets more complicated as you need to check states of modules, open them if required, etc

I would also advise trying to get on the IBM dxl course as then you will have the basics about how it all works (note much of dxl is based on C++ - constructs and functions)

cheers Ben

 

Re: How do I reverse the source and target choices in a linket
llandale - Thu Sep 27 12:43:08 EDT 2012

No, you cannot "switch" the direction; instead you must recreate the links going in the correct direction and then delete the old links.

I would do it this way:
  1. create the new forward linkset
  2. for each backward link, create a forward corresponding link
  3. make sure all such links are in pairs
  4. delete the old backward link-set

-Louie

Re: How do I reverse the source and target choices in a linket
Bob_Swan - Fri Sep 28 02:55:46 EDT 2012

y' linkset, rightclick and select 'reverse linkset'.

But neither system is a lot of help if some the linkset contains some correct links.

Re: How do I reverse the source and target choices in a linket
rmoskwa - Fri Sep 28 16:24:03 EDT 2012

The link_ed.zip from Mathias at https://www.ibm.com/developerworks/forums/thread.jspa?threadID=335195 may be of use to you. I recommend that you try the dxl on some "test" modules before you try it on your important modules. I would Archive the important modules before changing them too.